From: Caolán McNamara Date: Wed, 6 May 2026 14:37:30 +0000 (+0100) Subject: [PATCH] check for hb_shape_full failure X-Git-Tag: archive/raspbian/4%25.2.3-2+rpi1+deb13u6^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=cf7a730781913d44dc7b428bd9a2be4b8faa2434;p=libreoffice.git [PATCH] check for hb_shape_full failure Signed-off-by: Caolán McNamara Change-Id: I5fafcb7d592fb4c9091cb2bab64cb6ac47462d71 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2102 Reviewed-by: Miklos Vajna (cherry picked from commit 22c19be8fae977a90f83a82d8acccd0b46c7cf20) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204946 Tested-by: Jenkins Reviewed-by: Julien Nabet Gbp-Pq: Name check-for-hb_shape_full-failure.diff --- diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index b40851a2f18..dc7dd332cef 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -203,10 +203,11 @@ public: // The shapers that we want HarfBuzz to use, in the order of // preference. const char* const pHbShapers[] = { "graphite2", "ot", "fallback", nullptr }; - bool ok - = hb_shape_full(pHbFont, m_pHbBuffer, maFeatures.data(), maFeatures.size(), pHbShapers); - assert(ok); - (void)ok; + if (!hb_shape_full(pHbFont, m_pHbBuffer, maFeatures.data(), maFeatures.size(), pHbShapers)) + { + SAL_WARN("vcl.harfbuzz", "hb_shape_full failed"); + hb_buffer_set_length(m_pHbBuffer, 0); + } int nRunGlyphCount = hb_buffer_get_length(m_pHbBuffer); hb_glyph_info_t* pHbGlyphInfos = hb_buffer_get_glyph_infos(m_pHbBuffer, nullptr); @@ -595,9 +596,11 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay // The shapers that we want HarfBuzz to use, in the order of // preference. const char*const pHbShapers[] = { "graphite2", "ot", "fallback", nullptr }; - bool ok = hb_shape_full(pHbFont, pHbBuffer, maFeatures.data(), maFeatures.size(), pHbShapers); - assert(ok); - (void) ok; + if (!hb_shape_full(pHbFont, pHbBuffer, maFeatures.data(), maFeatures.size(), pHbShapers)) + { + SAL_WARN("vcl.harfbuzz", "hb_shape_full failed"); + hb_buffer_set_length(pHbBuffer, 0); + } // Populate glyph cluster remapping data stClusterMapper.ShapeSubRun(pStr, nLength, aSubRun, pHbFont, maFeatures, oHbLanguage);